package cn.wsalix.init;

import java.util.List;
import java.util.Map;

import javax.annotation.PostConstruct;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.wsalix.admin.service.DataInitService;
import cn.wsalix.install.Install;
import cn.wsalix.spring.SpringUtils;
@Service("projectInit")
public class ProjectInit {
	private static final Logger logger = LoggerFactory
			.getLogger(ProjectInit.class);
	private List<Install> installs;
	@Autowired
	private Install adminInstall;
	@Autowired
	private SpringUtils springUtils;
	@Autowired
	private PermitInit permitInit;
	@Autowired
	private DataInitService dataInitService;
	Map<String, Object> annotationBeans;
	//applicationContext.getBeansWithAnnotation(Controller.class);
	@Transactional
	public void initCheck(boolean create) {
		logger.info("");
		dataInitService.dictInit(create);
		dataInitService.roleInit(create);
		dataInitService.adminInit(create);		
		//permitInit.init(create);
		
/*		Map<String, Object> annotationBeans = springUtils
				.getBeansWithAnnotation(Controller.class);
		springUtils.traverse(annotationBeans);*/
		//dataInitService.roleCheck();
		//dataInitService.permitCheck();
		/*for (Install install : installs) {
			logger.info(install.getClass().getName() + " begin....");
			install.invoke();
			logger.info(install.getClass().getName() + " end");
		}*/
	}
	@PostConstruct  
	private void init() { 
		logger.info("");
		/*installs = new ArrayList<Install>();
		installs.add(adminInstall);*/
	}

}
